import { ConditionCheckerSystem } from '../condition-checker';
import type { Condition, ConditionProgress } from '../condition-checker/type';
import type { BaseModel } from '../../model/base';
import type { ModelName } from '../../constants/model-names';

export class PlayerStateSystem {
  private models: Map<string, BaseModel> = new Map();
  private conditionChecker: ConditionCheckerSystem;

  constructor() {
    this.conditionChecker = new ConditionCheckerSystem(this);
  }

  registerModel(name: string, model: BaseModel) {
    this.models.set(name, model);
  }

  getModel<T>(modelName: ModelName): T {
    return this.models.get(modelName) as T;
  }

  checkCondition(condition: Condition): boolean {
    return this.conditionChecker.checkCondition(condition);
  }

  checkConditions(conditions: Condition[]): boolean {
    return this.conditionChecker.checkConditions(conditions);
  }

  getConditionProgress(condition: Condition): ConditionProgress {
    return this.conditionChecker.getConditionProgress(condition);
  }

  getConditionsProgress(conditions: Condition[]): ConditionProgress[] {
    return this.conditionChecker.getConditionsProgress(conditions);
  }
}
